package com.wms.util;

/**
 * ---Do First---
 *
 * @author:wellseasun
 * @date:2025/4/21 下午 1:03
 * @desc: 状态码
 */

public class R {
    /**
     * code,指状态码,
     * 随意定,200 是正确
     * msg,指信息描述
     * data,返回的数据
     */
    private int code;
    private String msg;
    private Object data;

    public static R ok() {
        R r = new R();
        r.setCode(20000);
        r.setMsg("成功");
        return r;
    }

    public static R ok(Object data) {
        R r = new R();
        r.setCode(20000);
        r.setMsg("成功");
        r.setData(data);
        return r;
    }


    public static R fail() {
        R r = new R();
        r.setCode(400);
        r.setMsg("失败");
        return r;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
